package com.guaoran.source.mybatis;

import com.guaoran.source.mybatis.bean.Demo;
import com.guaoran.source.mybatis.config.Configuration;
import com.guaoran.source.mybatis.execute.DefaultExecutor;
import com.guaoran.source.mybatis.mapper.DemoMapper;
import com.guaoran.source.mybatis.session.SqlSession;

import java.io.IOException;

/**
 * @author : 孤傲然
 * @Description :
 * @date :2018/5/25 23:18
 */
public class Application {
    public static void main(String[] args) throws IOException {
        Configuration configuration = new Configuration();
        configuration.setScanPath("com.guaoran.source.mybatis.mapper");
        configuration.build();
        SqlSession sqlSession = new SqlSession(configuration,new DefaultExecutor(configuration));
        DemoMapper mapper = sqlSession.getMapper(DemoMapper.class);
        Demo demo = mapper.queryDemoById(2);
        System.out.println(demo);
    }
}
